package model

import (
	"gorm.io/gorm"
	"time"
)

type Comment struct {
	Id          uint           `gorm:"column:id;type:bigint(20) UNSIGNED;primaryKey;not null;" json:"id"`
	UserId      uint           `gorm:"column:user_id;type:bigint(20) UNSIGNED;comment:用户id;not null;default:0;" json:"user_id"`   // 用户id
	VideoId     uint           `gorm:"column:video_id;type:bigint(20) UNSIGNED;comment:视频id;not null;default:0;" json:"video_id"` // 视频id
	Content     string         `gorm:"column:content;type:varchar(300);comment:评论内容;not null;" json:"content"`                    // 评论内容
	CommentTime time.Time      `gorm:"column:comment_time;type:datetime(3);comment:评论时间;not null;" json:"comment_time"`           // 评论时间
	Give        uint           `gorm:"column:give;type:int(10) UNSIGNED;comment:点赞数量;not null;default:0;" json:"give"`            // 点赞数量
	CreatedAt   time.Time      `gorm:"column:created_at;type:datetime(3);not null;" json:"created_at"`
	UpdatedAt   time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt   gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (cm *Comment) TableName() string {
	return "comment"
}
